package com.ljs.liojbackendquestionservice.controller.inner;

import com.ljs.libackendmodel.model.entity.Question;
import com.ljs.libackendmodel.model.entity.QuestionSubmit;
import com.ljs.libackendmodel.model.entity.User;
import com.ljs.libackendmodel.model.vo.UserVO;
import com.ljs.liojbackendquestionservice.service.QuestionService;
import com.ljs.liojbackendquestionservice.service.QuestionSubmitService;
import com.ljs.liojbackendserviceclient.service.QuestionFeignClient;
import com.ljs.liojbackendserviceclient.service.UserFeignClient;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;

/**
 * 该服务仅在内部使用
 */
@RestController()
@RequestMapping("/inner")
public class QuestionInnerController implements QuestionFeignClient {
    @Resource
    private QuestionService questionService;
    @Resource
    private QuestionSubmitService questionSubmitService;

    @Override
    @GetMapping("/get/id")
    public Question getQuestionById(@RequestParam("questionId") long questionId) {
             return  questionService.getById(questionId);
    }

    @Override
    @GetMapping("/question_submit/get/id")
    public QuestionSubmit getQuestionSubmitById(@RequestParam("questionSubmitId") long questionSubmitId) {
        return questionSubmitService.getById(questionSubmitId);
    }

    @Override
    @PostMapping("/question_submit/update")
    public boolean questionSubmitSUpdateById(@RequestBody QuestionSubmit questionSubmit) {

    return questionSubmitService.updateById(questionSubmit);
    }

}
